package com.reds.backend.service.impl.admin;

import com.reds.backend.utils.adminUtils.codeMaker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import com.reds.backend.service.admin.emailSendService;
@Service
public class emailSendServiceImpl implements emailSendService{
    @Autowired
    JavaMailSender javaMailSender;
    @Autowired
    codeMaker codeMaker = new codeMaker();
    @Override
    public String sendRegisterEmail(String from, String to, String cc, String subject, String content) {
        SimpleMailMessage simpMsg = new SimpleMailMessage();
        String str = codeMaker.kaptchaProducer().createText();
        simpMsg.setFrom(from);
        simpMsg.setTo(to);
        simpMsg.setCc(cc);
        simpMsg.setSubject(subject);
        simpMsg.setText("您正在申请成为江西省红色文化资源管理系统管理员,您的注册验证码是:   "+str+"   请在五分钟之内完成注册,为了保证您的帐户安全，请勿向任何人提供此验证码。本邮件由系统自动发送，请勿直接回复。");
        javaMailSender.send(simpMsg);
        return str;
    }
}
